package com.ruoyi.web.controller.system;

import java.util.List;

import com.ruoyi.common.core.domain.entity.WeSealDoctment;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.service.IWeSealDoctmentService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 文档签章信息（网页签章）Controller
 * 
 * @author ess
 * @date 2021-10-18
 */
@RestController
@RequestMapping("/system/weSealDoctment")
public class WeSealDoctmentController extends BaseController
{
    @Autowired
    private IWeSealDoctmentService weSealDoctmentService;

    /**
     * 查询文档签章信息（网页签章）列表
     */
    @PreAuthorize("@ss.hasPermi('system:weSealDoctment:list')")
    @GetMapping("/list")
    public TableDataInfo list(WeSealDoctment weSealDoctment)
    {
        startPage();
        List<WeSealDoctment> list = weSealDoctmentService.selectWeSealDoctmentList(weSealDoctment);
        return getDataTable(list);
    }

    /**
     * 导出文档签章信息（网页签章）列表
     */
    @PreAuthorize("@ss.hasPermi('system:weSealDoctment:export')")
    @Log(title = "文档签章信息（网页签章）", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(WeSealDoctment weSealDoctment)
    {
        List<WeSealDoctment> list = weSealDoctmentService.selectWeSealDoctmentList(weSealDoctment);
        ExcelUtil<WeSealDoctment> util = new ExcelUtil<WeSealDoctment>(WeSealDoctment.class);
        return util.exportExcel(list, "文档签章信息（网页签章）数据");
    }

    /**
     * 获取文档签章信息（网页签章）详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:weSealDoctment:query')")
    @GetMapping(value = "/{sealdoctmentid}")
    public AjaxResult getInfo(@PathVariable("sealdoctmentid") String sealdoctmentid)
    {
        return AjaxResult.success(weSealDoctmentService.selectWeSealDoctmentBySealdoctmentid(sealdoctmentid));
    }

    /**
     * 新增文档签章信息（网页签章）
     */
    @PreAuthorize("@ss.hasPermi('system:weSealDoctment:add')")
    @Log(title = "文档签章信息（网页签章）", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WeSealDoctment weSealDoctment)
    {
        return toAjax(weSealDoctmentService.insertWeSealDoctment(weSealDoctment));
    }

    /**
     * 修改文档签章信息（网页签章）
     */
    @PreAuthorize("@ss.hasPermi('system:weSealDoctment:edit')")
    @Log(title = "文档签章信息（网页签章）", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WeSealDoctment weSealDoctment)
    {
        return toAjax(weSealDoctmentService.updateWeSealDoctment(weSealDoctment));
    }

    /**
     * 删除文档签章信息（网页签章）
     */
    @PreAuthorize("@ss.hasPermi('system:weSealDoctment:remove')")
    @Log(title = "文档签章信息（网页签章）", businessType = BusinessType.DELETE)
	@DeleteMapping("/{sealdoctmentids}")
    public AjaxResult remove(@PathVariable String[] sealdoctmentids)
    {
        return toAjax(weSealDoctmentService.deleteWeSealDoctmentBySealdoctmentids(sealdoctmentids));
    }
}
